fix(tabs): never show a blank native tab title for background or restored tabs - #1894
Merged
Conversation
datlechin
force-pushed
the
fix/window-tab-blank-title
branch
from
July 16, 2026 17:32
b4ff973 to
2d5f867
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
User feedback: a window tab sometimes shows no name in the native tab bar. Switching to the tab makes the name appear.
Two defects compound:
titlekey is missing or null decodes to an empty string. On session restore that empty string wins the title resolution chain over the real table name, so the window is created with an empty title.viewWillAppearor the SwiftUI lifecycle that recomputes titles. The native tab label renderswindow.title, so the tab stays blank until first activation computes the title for the first time.Underneath, five independent call sites wrote the window title with divergent precedence rules, and none treated a present-but-empty string as absent.
Fix
WindowTitleResolver: one pure resolver both the payload-driven initial title and the tab-driven ongoing updates funnel through. Blank strings are treated as absent at every tier, and table tabs always recompute their name fromtableNameandschemaNameinstead of trusting a carried-over string.MainSplitViewController.windowTitle'sdidSetis now a guarded sink: an empty string can never reachNSWindow.titlefrom any path, including the SwiftUI binding.TabWindowController.initpushes the resolved title onto the window right after assigningcontentViewController, so a background tab is labeled before it is ever activated.PersistedTabdecodes a missing title to "Query" (the live constructor default) instead of "".NSApp.keyWindow?.titlewrite in FK navigation, which could retitle the wrong window.markTabRenamed, so their title changes reach the window immediately.Behavior note: a table tab in a non-default schema now shows
schema.tableconsistently, instead of flipping to the bare table name after the first tab switch.Tests
WindowTitleResolverTestsreplacesMainSplitViewControllerTitleTests: the 11 existing cases retargeted, plus regressions for every blank-falls-through tier, schema qualification, and the sanitizer.PersistedTabRoundTripTests: missing, null, and present title decode cases.swiftlint lint --strictclean.No UI automation: the symptom is only observable in the native tab strip of a never-activated window, which needs on-disk tab-state seeding and native tab accessibility reads that do not run deterministically in CI. The regression is pinned at the resolver and decode layers instead.